<template>
	<view class="page container">
		<u-form :model="basicForm" :rules="rules" labelPosition="top" ref="form" labelWidth="auto" :labelStyle="{
        fontSize: '14px',
        color: '#B2B2B2',
        lineHight: '20px',
      }">
			<view class="basic-style">
				<u-form-item label="项目名称" prop="projectId" :required="isRelProject">
					<h-select-project-input-popup v-model="basicForm.projectId" :disabled="!isRelProject || disabled"
						:signUnit="companyId" :queryParamType="'1'" :teamId="teamId" class="w-100" placeholder="请选择项目名称"
						searchPlaceholder="请输入项目名称" border="surround" suffixIcon="arrow-down-fill"
						:suffixIconStyle="{ color: '#B2B2B2' }"
						@change="handleProjectSelect"></h-select-project-input-popup>
				</u-form-item>
				<u-form-item label="项目编号" prop="projectCode">
					<u--input disabled placeholder="请输入项目编号" v-model="basicForm.projectCode"></u--input>
				</u-form-item>
				<u-form-item label="业绩归属年度" prop="attributionYear">
					<h-select-input-tag disabled class="w-100" v-model="basicForm.attributionYear"
						objectField="basicForm.attributionYear" placeholder="请选择业绩归属年度" border="surround"
						dictName="yjgsnd"></h-select-input-tag>
				</u-form-item>
				<u-form-item label="任务分类" prop="taskId" :required="isRelProject">
					<h-select-task-input-popup 
						:projectId="basicForm.projectId" 
						:customParams="{
              projectId: basicForm.projectId,
            }"
						v-model="basicForm.taskId"
						:disabled="!isRelProject || !basicForm.projectId || disabled"
						class="w-100"
						:placeholder="basicForm.projectId ? '请选择任务分类' : '请先选择项目名称'"
						searchPlaceholder="请输入业务分类"
						border="surround"
						suffixIcon="arrow-down-fill"
						:suffixIconStyle="{ color: '#B2B2B2' }"
						@realChange="handleTaskSelect"
						:isFlowCancel="'running'"
						:api="erpOmcProjectTaskAllList"
					></h-select-task-input-popup>
				</u-form-item>
					<!-- @select="basicForm.taskDescription = $event.data.taskDescription" -->
				<template v-if="isRelProject != '1'">
					<u-form-item label="任务说明" prop="taskDescription">
						<u--input disabled placeholder="选择任务分类后自动带出" v-model="basicForm.taskDescription"></u--input>
					</u-form-item>
					
				</template>
				<u-form-item label="出发时间" prop="setOutTime" required>
					<h-time-select mode="datetime" :disabled="disabled" ref="setOutTime" v-model="basicForm.setOutTime" :formatter="formatter" placeholder="请选择出发时间" format="yyyy-mm-dd hh"
						border="surround" suffixIcon="calendar-fill" :suffixIconStyle="{ color: '#B2B2B2' }"
						@change="handleTimeChange"></h-time-select>
				</u-form-item>
				<u-form-item label="回程时间" prop="backTime" required>
					<h-time-select ref="backTime" mode="datetime" :disabled="disabled" v-model="basicForm.backTime" :formatter="formatter" placeholder="请选择回程时间" format="yyyy-mm-dd hh"
						border="surround" suffixIcon="calendar-fill" :suffixIconStyle="{ color: '#B2B2B2' }"
						@change="handleTimeChange"></h-time-select>
				</u-form-item>
				<u-form-item label="出差天数" prop="days">
					<u--input disabled placeholder="请输入出差天数" v-model="basicForm.days"></u--input>
				</u-form-item>
				<template v-if="isTrip">
					<u-form-item label="报销内容" prop="feeType" required>
						<h-select-input-tag class="w-100" v-model="basicForm.feeType" placeholder="请选择报销内容"
							border="surround" suffixIcon="arrow-down-fill" :suffixIconStyle="{ color: '#B2B2B2' }"
							dictName="reimbursement_content"></h-select-input-tag>
					</u-form-item>
					<u-form-item label="交通方式" prop="transportMode">
						<h-select-input-tag class="w-100" :disabled="disabled" v-model="basicForm.transportMode" placeholder="请选择交通方式" :isDeselect="true"
							border="surround" suffixIcon="arrow-down-fill" :suffixIconStyle="{ color: '#B2B2B2' }"
							dictName="transportation"></h-select-input-tag>
					</u-form-item>
				</template>
				<template v-if="isDrive">
					<u-form-item label="报销内容" prop="selfDriving" required>
						<h-select-input-tag class="w-100" v-model="basicForm.selfDriving"
							objectField="basicForm.selfDriving" placeholder="请选择报销内容" border="surround"
							suffixIcon="arrow-down-fill" :suffixIconStyle="{ color: '#B2B2B2' }"
							dictName="expense_account">
						</h-select-input-tag>
					</u-form-item>
					<u-form-item label="交通方式" prop="selfDrivingMode">
						<h-select-input-tag class="w-100" v-model="basicForm.selfDrivingMode" :isDeselect="true"
							objectField="basicForm.selfDrivingMode" :disabled="disabled" placeholder="请选择交通方式" dictName="traffic"
							border="surround" suffixIcon="arrow-down-fill" :suffixIconStyle="{ color: '#B2B2B2' }">
						</h-select-input-tag>
					</u-form-item>
				</template>
				<u-form-item label="出发地点" prop="departurePlace" required>
					<h-select-address-input class="w-100" v-model="basicForm.departurePlace" placeholder="请选择出发地点"
						border="surround" suffixIcon="arrow-down-fill" :disabled="disabled"
						:suffixIconStyle="{ color: '#B2B2B2' }"></h-select-address-input>
				</u-form-item>
				<u-form-item label="到达地点" prop="targetPlace" required>
					<h-select-address-input class="w-100" v-model="basicForm.targetPlace" placeholder="请选择到达地点"
						border="surround" suffixIcon="arrow-down-fill" :disabled="disabled"
						:suffixIconStyle="{ color: '#B2B2B2' }"></h-select-address-input>
				</u-form-item>

				<template v-if="isTrip">
					<u-form-item label="发票类型" prop="isSpecial" required>
						<h-select-input-tag class="w-100" v-model="basicForm.isSpecial"
							objectField="basicForm.isSpecial" placeholder="请选择发票类型" border="surround"
							suffixIcon="arrow-down-fill" :suffixIconStyle="{ color: '#B2B2B2' }" dictName="invoice_type"
							@change="lxChange"></h-select-input-tag>
					</u-form-item>
					<u-form-item label="报销金额(元)" prop="amount" required>
						<h-money-input placeholder="请输入报销金额" v-model="basicForm.amount"
							@change="handleAmountChange"></h-money-input>
					</u-form-item>
					<u-form-item label="税费金额(元)" prop="taxation" :required="!isSpecialDisabled">
						<h-money-input
							placeholder="请输入税费金额"
							v-model="basicForm.taxation"
							:disabled="isSpecialDisabled"
							@input="handleAmountChange"
						></h-money-input>
					</u-form-item>
					<u-form-item label="未税金额(元)" prop="untaxedAmount">
						<h-money-input disabled placeholder="请输入未税金额" v-model="basicForm.untaxedAmount"
							:min="0"></h-money-input>
					</u-form-item>
					<u-form-item label="税率(%)" prop="taxRate" :required="!isTaxRateDisabled">
						<h-number-input
							placeholder="请输入税率"
							:disabled="isTaxRateDisabled"
							v-model="basicForm.taxRate"
							:digit="0" :max="99999999"
							:min="0"
						></h-number-input>
					</u-form-item>
				</template>

				<template v-if="isDrive">
					<u-form-item label="出发里程数(km)" prop="startMileage" required>
						<h-number-input placeholder="请输入出发里程数" :disabled="disabled" v-model="basicForm.startMileage" :digit="0" :min="1"
							@change="handleMileageChange"></h-number-input>
						<!-- <u--input
              type="number"
              v-number-normal
              placeholder="请输入出发里程数"
              v-model="basicForm.startMileage"
              @change="handleMileageChange"
            ></u--input> -->
					</u-form-item>
					<u-form-item label="返程里程数(km)" prop="endMileage" required>
						<h-number-input placeholder="请输入返程里程数" :disabled="disabled" v-model="basicForm.endMileage" :digit="0" :min="1"
							@change="handleMileageChange"></h-number-input>
						<!-- <u--input
              type="number"
              v-number-normal
              placeholder="请输入返程里程数"
              v-model="basicForm.endMileage"
              @change="handleMileageChange"
            ></u--input> -->
					</u-form-item>
					<u-form-item label="里程数(km)" prop="mileage">
						<h-number-input disabled placeholder="请输入里程数" v-model="basicForm.mileage" :digit="0"
							:min="0"></h-number-input>
						<!-- <u--input type="number" v-number-normal placeholder="请输入里程数" v-model="basicForm.mileage" disabled></u--input> -->
					</u-form-item>
					<u-form-item label="补贴单价(元)" prop="subsidyUnitPrice">
						<h-select-input-tag class="w-100" v-model="basicForm.subsidyUnitPrice"
							objectField="basicForm.subsidyUnitPrice" placeholder="请选择补贴单价" border="surround" :disabled="disabled"
							dictName="subsidy" suffixIcon="arrow-down-fill" :suffixIconStyle="{ color: '#B2B2B2' }" :isDeselect="true"
							@change="subsidyUnitPriceInput"></h-select-input-tag>
					</u-form-item>
					<u-form-item label="报销金额(元)" prop="amount" required>
						<h-money-input disabled placeholder="请输入报销金额" v-model="basicForm.amount"></h-money-input>
					</u-form-item>
					<u-form-item label="补助领款人" prop="oilCard" required>
						<h-select-oilcard-input-popup class="w-100" v-model="basicForm.oilCard" placeholder="请选择补助领款人" :disabled="disabled"
							border="surround" suffixIcon="arrow-down-fill" :suffixIconStyle="{ color: '#B2B2B2' }"
							@change="oilCardBack"></h-select-oilcard-input-popup>
					</u-form-item>
				</template>

				<!-- <u-form-item label="备注" prop="remark">
					<u--textarea v-model="basicForm.remark" :cursorSpacing="100" :confirm-type="null" maxlength="500"
						count placeholder="请输入备注"></u--textarea>
				</u-form-item> -->
			</view>

			<view class="space-x-1 mt-1" style="display: flex">
				<u-button type="primary" text="保存" :loading="loading" @click="onSubmit"></u-button>
				<u-button type="primary" text="关闭" :loading="loading" @click="onClose"></u-button>
			</view>
		</u-form>
	</view>
</template>

<script>
	import Decimal from 'decimal.js'
	import moment from 'moment'
	import { erpOmcProjectTaskAllList } from '@/api/index.js'
	export default {
		name: 'BillForm',
		props: {
			teamId: {
				type: [String, Number],
				default: '',
			},
			companyId: {
				type: [String, Number],
				default: '',
			},
			// 表单禁用
			disabled: {
				type: Boolean,
				default: false,
				required: false,
			},
			isRelProject: {
				type: Boolean,
				default: false,
			},
			datailDisabled: {
				type: Boolean,
				default: false,
			},
			index: {
				type: Number,
				default: null,
			},
			formType: {
				type: String,
				default: 'trip',
			},
		},
		data() {
			return {
				isSpecialDisabled: false,
				isTaxRateDisabled: false,
				erpOmcProjectTaskAllList,
				loading: false,
				basicForm: {
					projectId: '',
					projectCode: '',
					taskId: '',
					taskDescription: '',
					attributionYear: '',
					setOutTime: '',
					backTime: '',
					days: '',
					feeType: '',
					transportMode: '',
					departurePlace: '',
					targetPlace: '',
					// remark: '',
					// 报销明细
					isSpecial: '',
					amount: null,
					taxation: null,
					untaxedAmount: null,
					taxRate: '',
					// 自驾公里数补助明细
					startMileage: null,
					endMileage: null,
					mileage: null,
					subsidyUnitPrice: null,
					oilCard: null,
				},
				rules: {
					departurePlace: [{
						required: true,
						message: '请选择出发地点!',
						trigger: ['change', 'blur']
					}],
					targetPlace: [{
						required: true,
						message: '请选择到达地点!',
						trigger: ['change', 'blur']
					}],
					startMileage: [{
							required: true,
							message: '请输入出发里程数!',
							trigger: ['change', 'blur']
						},
						{
							pattern: /^[0-9]*[1-9][0-9]*$/,
							message: '请输入正整数!'
						},
					],
					endMileage: [{
							required: true,
							message: '请输入返程里程数!',
							trigger: ['change', 'blur']
						},
						{
							pattern: /^[0-9]*[1-9][0-9]*$/,
							message: '请输入正整数!'
						},
					],
					isSpecial: [{
						required: true,
						message: '请选择发票类型!',
						trigger: ['change', 'blur']
					}],
					amount: [{
						required: true,
						trigger: ['change', 'blur'],
						// pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/,
						pattern: /^(?!0\.00)(?!0$)([1-9]\d*|0)(\.\d{2})?$/,
						message: '请输入正确的报销金额!',
					}, ],
					// taxRate: [{ required: true, message: '请填写税率!', trigger: ['change', 'blur'] }],
					oilCard: [{
						required: true,
						message: '请选择补助领款人!',
						trigger: ['change', 'blur']
					}],
					setOutTime: [{
						required: true,
						message: '请选择出发时间!',
						trigger: ['change', 'blur']
					}],
					backTime: [{
						required: true,
						message: '请选择回程时间!',
						trigger: ['change', 'blur']
					}],
					feeType: [{
						required: true,
						message: '请选择报销内容!',
						trigger: ['change', 'blur']
					}],
					selfDriving: [{
						required: true,
						message: '请选择报销内容!',
						trigger: ['change', 'blur']
					}],
				},
			}
		},
		computed: {
			isTrip() {
				return this.formType === 'trip'
			},
			isDrive() {
				return this.formType === 'drive'
			},
			isBottomForm() {
				return this.formType === 'bottomForm'
			},
		},
		created() {},
		mounted() {
			const val = this.isRelProject
			if (val) {
				this.$set(this.rules, 'projectId', [{
					required: true,
					message: '请选择关联项目!',
					trigger: 'change'
				}])
				this.$set(this.rules, 'taskId', [{
					required: true,
					message: '请选择任务分类!',
					trigger: 'change'
				}])
			} else {
				this.$set(this.rules, 'projectId', [])
				this.$set(this.rules, 'taskId', [])
			}
		},
		methods: {
			formatter(type,value){
				if(type == 'minute'){
					return '00'
				}
				return value
			},
			oilCardBack(item) {
				if (item) {
					this.$set(this.basicForm, 'subsidyProposer', item.cardRecipient)
				}
			},
			lxChangeInit(value) {
				if (value == '0') {
					// 普票：税费和税率默认为0，发起人不可编辑和修改（流程中也不可修改）
					this.$delete(this.rules, 'taxation');
					this.$delete(this.rules, 'taxRate');
					this.isSpecialDisabled=true;
					this.isTaxRateDisabled=true;
				} else {
					if (value == '1') {
					// 专票：税费和税率为必填，发起人可编辑和修改 （税率计算公式：税费金额/未税金额取整，流程中都可修改）
					this.$set(this.rules, 'taxRate', [{ required: true, message: '请输入正确的税率!'}]);
					this.$set(this.rules, 'taxation', [
						{ required: true, message: '请输入税费金额!', trigger: 'blur' },
						{ pattern: /^(?!0\.00)(?!0$)([1-9]\d*|0)(\.\d{2})?$/, message: '请输入正确的税费金额!' }
					]);
					this.isSpecialDisabled=false;
					this.isTaxRateDisabled=false;
					} else {
						// 其他或者不填：税费金额必填默认为0，发起人可修改，税率默认为0，发起人不可编辑和修改（流程中可以修改税费金额，不可修改税率）
						this.$delete(this.rules, 'taxRate');
						this.$set(this.rules, 'taxation', [
							{ required: true, message: '请输入税费金额!', trigger: 'blur' },
							{ pattern: /^(([0-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的税费金额!' }
						]);
						this.isSpecialDisabled=false;
						this.isTaxRateDisabled=true;
					}
				}
			},
			lxChange(value) {
				this.$refs.form.clearValidate('taxation')
				if (value == '0') {
					// 普票：税费和税率默认为0，发起人不可编辑和修改（流程中也不可修改）
					this.$set(this.basicForm, 'taxation',0.00);
					this.$set(this.basicForm, 'taxRate',0);
					this.$delete(this.rules, 'taxation');
					this.$delete(this.rules, 'taxRate');
					this.$refs.form.clearValidate('taxation');
					this.$refs.form.clearValidate('taxRate');
					this.isSpecialDisabled=true;
					this.isTaxRateDisabled=true;
					if (this.basicForm.amount || this.basicForm.amount == 0) {
						try {
							let money = new Decimal(this.basicForm.amount || 0).sub(new Decimal(this.basicForm.taxation || 0))
							this.$set(this.basicForm, 'untaxedAmount', money.toNumber().toFixed(2))
							// this.basicForm.untaxedAmount = money.toNumber().toFixed(2)
						} catch (error) {
						}
					}
				} else {
					this.$refs.form.clearValidate('taxation')
					if (value == '1') {
						// 专票：税费和税率为必填，发起人可编辑和修改 （税率计算公式：税费金额/未税金额取整，流程中都可修改）
						this.$set(this.basicForm, 'taxation',null);
						this.$set(this.basicForm, 'taxRate',null);
						this.$set(this.rules, 'taxRate', [{ required: true, message: '请输入正确的税率!'}]);
						this.$set(this.rules, 'taxation', [
							{ required: true, message: '请输入税费金额!', trigger: 'blur' },
							{ pattern: /^(?!0\.00)(?!0$)([1-9]\d*|0)(\.\d{2})?$/, message: '请输入正确的税费金额!' }
						])
						this.isSpecialDisabled=false;
						this.isTaxRateDisabled=false;
					} else {
						// 其他或者不填：税费金额必填默认为0，发起人可修改，税率默认为0，发起人不可编辑和修改（流程中可以修改税费金额，不可修改税率）
						this.$set(this.basicForm, 'taxation',0.00);
						this.$set(this.basicForm, 'taxRate',0);
						this.$delete(this.rules, 'taxRate');
						this.$set(this.rules, 'taxation', [
							{ required: true, message: '请输入税费金额!', trigger: 'blur' },
							{ pattern: /^(([0-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的税费金额!' }
						])
						this.isSpecialDisabled=false;
						this.isTaxRateDisabled=true;
					}
					if (this.basicForm.amount || this.basicForm.amount == 0) {
						this.$set(this.basicForm, 'untaxedAmount', this.basicForm.amount)
					}
				}
			},
			handleTaskSelect(data) {
				// this.basicForm.taskDescription = data.taskDescription
				if(data) {
					this.$set(this.basicForm, 'taskDescription', data.taskDescription)
				}else{
					this.$set(this.basicForm, 'taskDescription', '')
				}
				
			},
			handleMileageChange() {
				const {
					startMileage,
					endMileage,
					subsidyUnitPrice
				} = this.basicForm
				if ((startMileage || startMileage === 0) && (endMileage || endMileage === 0)) {
					mileage = endMileage - startMileage
					let mileage = new Decimal(endMileage).sub(new Decimal(startMileage))
					// this.basicForm.mileage = mileage.toNumber().toFixed(2)
					this.$set(this.basicForm, 'mileage', mileage.toNumber().toFixed(2))
				}
				if (subsidyUnitPrice) {
					this.subsidyUnitPriceInput(subsidyUnitPrice)
				}
			},
			subsidyUnitPriceInput(data) {
				let price = 0.5
				if (data == 1) {
					price = 1
				} else if (data == 2) {
					price = 1.5
				}
				if (
					(this.basicForm.startMileage || this.basicForm.startMileage == 0) &&
					(this.basicForm.endMileage || this.basicForm.endMileage == 0)
				) {
					// this.basicForm.amount = price * this.basicForm.mileage
					this.$set(this.basicForm, 'amount', price * this.basicForm.mileage)
				}
			},
			getDaysBetween(date1, date2) {
				const startDate = Date.parse(date1)
				const endDate = Date.parse(date2)
				const date3 = endDate - startDate //时间差的毫秒数
				//计算出相差天数
				const days = Math.floor(date3 / (24 * 3600 * 1000))
				//计算出小时数
				const leave1 = date3 % (24 * 3600 * 1000) //计算天数后剩余的毫秒数
				const hours = Math.floor(leave1 / (3600 * 1000))

				const dayHours = days + '天' + hours + '小时'
				return dayHours
			},
			handleTimeChange() {
				const setOutTime = this.basicForm.setOutTime ? moment(this.basicForm.setOutTime).format('YYYY-MM-DD HH:mm:ss') : ''
				const backTime = this.basicForm.backTime ? moment(this.basicForm.backTime).format('YYYY-MM-DD HH:mm:ss') : ''
				// const {
				// 	setOutTime,
				// 	backTime
				// } = this.basicForm
				if (setOutTime && backTime) {
					if (moment(backTime).diff(moment(setOutTime), 'seconds') < 0) {
						// this.basicForm.backTime = setOutTime
						this.$set(this.basicForm, 'backTime', moment(setOutTime).format('YYYY-MM-DD HH'))
						this.$refs.backTime.valueName = moment(setOutTime).format('YYYY-MM-DD HH')
						this.$u.toast('回程时间不得小于出发时间')
						// this.basicForm.days = this.getDaysBetween(setOutTime, setOutTime)
						this.$set(this.basicForm, 'days', this.getDaysBetween(setOutTime, setOutTime))
						return
					}
					// this.basicForm.days = this.getDaysBetween(setOutTime, backTime)
					let db = this.getDaysBetween(setOutTime, backTime)
					this.$nextTick(() => {
						this.$set(this.basicForm, 'days', db)
						this.$forceUpdate();
					})
				}
			},
			handleAmountChange() {
				if ((Number(this.basicForm.amount) || Number(this.basicForm.amount) === 0) && (Number(this.basicForm.taxation) || Number(this.basicForm.taxation) === 0)) {
					try {
						let money = new Decimal(Number(this.basicForm.amount)).sub(new Decimal(Number(this.basicForm.taxation || 0)))
						// this.basicForm.untaxedAmount = money.toNumber().toFixed(2)
						if(this.basicForm.taxation !== null) {
							this.$set(this.basicForm, 'untaxedAmount', money.toNumber().toFixed(2))		
							this.$forceUpdate();
						}
						if(this.basicForm.taxation === '') {
							this.basicForm.taxation = null
							this.$set(this.basicForm, 'untaxedAmount', '')
							this.$forceUpdate();
						}
					} catch (error) {
						console.log(error)
					}
				}
			},
			handleProjectSelect(data) {
				const item = data,self = this;
				this.$set(this.basicForm, 'taskId', '')
				this.$set(this.basicForm, 'taskDescription', '')
				this.$set(this.basicForm, 'attributionYear', data?.year || '')
				this.$set(this.basicForm, 'projectCode', data?.finalNo || '')
				this.$nextTick(() => {
					self.$set(self.basicForm, 'projectId', item?.id || '')	
					self.$forceUpdate();
				})
			},
			reset() {
				this.$refs.form.resetFields()
			},
			async onSubmit() {
				await this.$refs.form.validate()
				this.basicForm.setOutTime = moment(this.basicForm.setOutTime).format('YYYY-MM-DD HH:mm:ss')
				this.basicForm.backTime = moment(this.basicForm.backTime).format('YYYY-MM-DD HH:mm:ss')
				if (!this.index) {
					this.$emit('submit', [{
							id: parseInt(Math.random() * 1000000000000),
							...this.basicForm,
						},
						this.index,
					])
				} else {
					this.$emit('submit', [this.basicForm, this.index])
				}
				this.reset()
			},
			onClose() {
				this.$emit('close')
				this.reset()
			},
		},
		watch: {
			// isRelProject(val) {
			//   if (val === '1') {
			//     this.$set(this.rules, 'projectId', [{ required: true, message: '请选择关联项目!', trigger: 'change' }])
			//     this.$set(this.rules, 'taskId', [{ required: true, message: '请选择任务分类!', trigger: 'change' }])
			//   } else {
			//     this.$set(this.rules, 'projectId', [])
			//     this.$set(this.rules, 'taskId', [])
			//   }
			// },
			basicForm: {
				handler(val) {
					if (val && val.isSpecial) {
						if (this.basicForm.isSpecial != '0') {
							if (this.basicForm.isSpecial == '1') {
								this.$refs.form.clearValidate('taxation')
								this.$set(this.rules, 'taxation', [{
									required: {
										required: true,
										message: '请输入税费金额!',
										trigger: ['change', 'blur']
									},
									pattern: /^(?!0\.00)(?!0$)([1-9]\d*|0)(\.\d{2})?$/,
									message: '请输入正确的税费金额!',
									trigger: ['blur', 'change'],
								}, ])
							} else {
								this.$refs.form.clearValidate('taxation')
								this.$set(this.rules, 'taxation', [{
									required: {
										required: true,
										message: '请输入税费金额!',
										trigger: ['change', 'blur']
									},
									pattern: /^(([1-9][0-9]*|0)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/,
									message: '请输入正确的税费金额!',
									trigger: ['blur', 'change'],
								}, ])
							}
						}
					}
				},
				deep: true,
			},
		},
	}
</script>

<style scoped>
	@import url('@/assets/inputStyle.scss');

	.page.container {
		padding: 20px;
	}

	.basic-style {
		margin: 0;
		max-height: 80vh;
		overflow-y: auto;
	}

	.u-form-item {
		padding: 0px 8px;
	}
</style>